#include <stdio.h>  
  
int main()
{  
    int arr[] = {1,4,2,5,3}; // 测试集合 
    int n = sizeof(arr) / sizeof(arr[0]);  
    int sum = 0;
    for (int start = 0; start < n; start++) {
        for (int length = 1; start + length <= n; length += 2) {
            int end = start + length - 1;
            for (int i = start; i <= end; i++) {
                sum += arr[i];
            }
        }
    }    
    printf("所有奇数长度子数组的和: %d\n", sum);  
    return 0;  
}